<html>
<head><meta charset="utf-8"><title>Running unit tests for compiler crates · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Running.20unit.20tests.20for.20compiler.20crates.html">Running unit tests for compiler crates</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="171766422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Running%20unit%20tests%20for%20compiler%20crates/near/171766422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Running.20unit.20tests.20for.20compiler.20crates.html#171766422">(Jul 26 2019 at 11:36)</a>:</h4>
<p>How do I run <code>#[test]</code> tests in various <code>librustc_x</code> crates? I've tried <code>./x.py --stage 1 test src/librustc_lexer</code>, but that unfortunately compiles the whole compiler before actually running the tests.</p>



<a name="171767353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Running%20unit%20tests%20for%20compiler%20crates/near/171767353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Running.20unit.20tests.20for.20compiler.20crates.html#171767353">(Jul 26 2019 at 11:57)</a>:</h4>
<p>Try <code>--stage 0</code>?</p>



<a name="171768767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Running%20unit%20tests%20for%20compiler%20crates/near/171768767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Running.20unit.20tests.20for.20compiler.20crates.html#171768767">(Jul 26 2019 at 12:21)</a>:</h4>
<p>I don't think you can pick the crates to test, nor avoid compiling the compiler</p>



<a name="171769740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Running%20unit%20tests%20for%20compiler%20crates/near/171769740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Running.20unit.20tests.20for.20compiler.20crates.html#171769740">(Jul 26 2019 at 12:37)</a>:</h4>
<p>Yeah, there's an open issue about that</p>



<a name="171776460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Running%20unit%20tests%20for%20compiler%20crates/near/171776460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Running.20unit.20tests.20for.20compiler.20crates.html#171776460">(Jul 26 2019 at 14:08)</a>:</h4>
<p>Did you see <a href="https://github.com/rust-lang/rust/pull/62996" target="_blank" title="https://github.com/rust-lang/rust/pull/62996">https://github.com/rust-lang/rust/pull/62996</a> ?</p>



<a name="171777138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Running%20unit%20tests%20for%20compiler%20crates/near/171777138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Running.20unit.20tests.20for.20compiler.20crates.html#171777138">(Jul 26 2019 at 14:16)</a>:</h4>
<p>that helps with the reason we need to do it but I think rustbuild might still be "dumb" and not do the right thing quite yet</p>



<a name="171782654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Running%20unit%20tests%20for%20compiler%20crates/near/171782654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Running.20unit.20tests.20for.20compiler.20crates.html#171782654">(Jul 26 2019 at 15:22)</a>:</h4>
<p>Heh, the discussion in <a href="https://github.com/rust-lang/rust/issues/61097" target="_blank" title="https://github.com/rust-lang/rust/issues/61097">#61097</a> seems interesting. Presumably, if we move forward with librarification of compiler, plain old unit tests and cargo integration tests would become more important.</p>



<a name="171785953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Running%20unit%20tests%20for%20compiler%20crates/near/171785953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Running.20unit.20tests.20for.20compiler.20crates.html#171785953">(Jul 26 2019 at 16:06)</a>:</h4>
<p>With <a href="https://github.com/rust-lang/rust/issues/61097" target="_blank" title="https://github.com/rust-lang/rust/issues/61097">#61097</a> unit tests require building the whole compiler <em>once</em>, after that they can be modified and run immediately with <code>./x.py test --stage 0 src/librustc_lexer</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>